﻿using System;
using System.Collections.Generic;
using System.Text;

namespace daSyntaxAnalyser.SyntaxTree
{
    using daBase.Objects;

    public class CaseBlockStatementElement : StatementElement
    {
        private List<ExpressionElement> caseparams;
        private StatementElement statement;

        public List<ExpressionElement> Params { get { return caseparams; } set { caseparams = value; } }
        public StatementElement Statement { get { return statement; } set { statement = value; } }

        public CaseBlockStatementElement(TokenInfo StartInfo, List<ExpressionElement> Params, StatementElement Statement, List<TokenInfo> Comments)
            : base(StartInfo, Comments)
        {
            caseparams = Params;
            statement = Statement;
        }

        public override string ToString()
        {
            return string.Format("{0} : {1}", caseparams.Join(", "), statement);
        }

        protected override IEnumerator<ISyntaxTreeElement> CreateEnumerator()
        {
            foreach (ExpressionElement caseparam in caseparams)
                yield return caseparam;
            if (statement != null)
                yield return statement;
        }
    }
}
